<template>
	<view class="contentPage">
		<view class="pageTitle">7日天气预报</view>
		<view class="listContent">
			<view class="df temperatureItem" v-for="(item,index) in moreWeather" :key="item.fxDate">
				<view class="item">{{item.relativeDate}} {{item.textDay}}</view>
				<iconCpn :weatherName="item.textDay"></iconCpn>
				<view class="item df">
					<view>{{item.tempMin}}°</view>
					<view class="progressBox"></view>
					<view>{{item.tempMax}}°</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup lang="ts">
	import { onMounted, reactive } from 'vue'
	import iconCpn from '@/pages/component/iconCpn.vue'
	const moreWeather = reactive([])
	onMounted(() => {
		uni.getStorage({
			key: 'moreWeather',
			success: function (res) {
				let list = JSON.parse(res.data)
				moreWeather.splice(0, moreWeather.length, ...list)
			}
		});
	})
</script>

<style lang="scss" scoped>
	.contentPage {
		background-color: #E8E8E8;
		padding: 24rpx;
		min-height: 100vh;

		.pageTitle {
			font-size: 50rpx;
			padding-left: 20rpx;
		}

		.listContent {
			margin-top: 20rpx;
			background-color: white;
			border-radius: 20rpx;

			.temperatureItem {
				align-items: center;
				justify-content: space-between;
				border-bottom: 1px solid rgba($color: #ffffff, $alpha: 0.1);
				padding: 18rpx;
				margin-bottom: 18rpx;

				.item {
					font-size: 28rpx;
					align-items: center;
					justify-content: space-between;
					width: 33%;

					.progressBox {
						width: 100rpx;
						height: 10rpx;
						border-radius: 50rpx;
						background-image: linear-gradient(90deg, gold, red);
						margin: 0 20rpx;
					}
				}
			}
		}
	}
</style>